/**
 * Created by eva on 2020/1/1.
 */
function Dust() {
    this.dustPics = [];
    this.x = [];
    this.y = [];
    this.amp = [];
    this.NO = [];
    this.alpha = 0;
    this.num = 30;
}
Dust.prototype = {
    init : function () {
        for(var i = 0; i < 7; i++){
            this.dustPics[i] = new Image();
            this.dustPics[i].src = "./src/dust"+i+".png";
        }
        for(var i = 0; i < this.num; i++){
            this.x[i] = Math.random()*canWidth;
            this.y[i] = Math.random()*canHeight;
            this.amp[i] = 20 + Math.random()*15;
            this.NO[i] = Math.floor(Math.random()*7);
        }
    },
    draw : function () {
        this.alpha += deltaTime*0.002;
        var l = Math.sin(this.alpha);
        for(var i = 0; i <  this.num; i++){
            var no = this.NO[i];
            ctx1.drawImage(this.dustPics[no],this.x[i]+l*this.amp[i],this.y[i]);
        }
    }
}